﻿namespace = german_unification #Replace with DVG specific when able

# North/South German Confederation
german_unification.1 = {
	type = country_event
	placement = ROOT

	title = german_unification.1.t
	desc = {
		first_valid = {
			triggered_desc = {
				desc = german_unification.1.d1
				trigger = {
					country_has_primary_culture = cu:north_german
				}
			}
			triggered_desc = {
				desc = german_unification.1.d2
				trigger = {
					country_has_primary_culture = cu:south_german
				}
			}
		}
	}
	flavor = german_unification.1.f

	event_image = {
		video = "gfx/event_pictures/unspecific_signed_contract.bk2"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"
	on_opened_soundeffect = "event:/SFX/Events/unspecific/signed_contract"

	icon = "gfx/interface/icons/event_icons/event_portrait.dds"

	duration = 3

	trigger = {
	}

	immediate = {
	}

	option = {
		name = german_unification.1.a
		default_option = yes
		every_interest_group = {
			limit = {
				is_in_government = yes
			}
			leader = {
				add_modifier = {
					name = german_unification_popularity
					months = long_modifier_time
				}
			}
		}
		if = {
			limit = {
				country_has_primary_culture = cu:north_german
				NOT = { exists = c:NGF }
				OR = {
					country_tier = kingdom
					country_tier = principality
				}
			}
			change_tag = NGF
		}
		else_if = {
			limit = {
				country_has_primary_culture = cu:south_german
				NOT = { exists = c:SGF }
				OR = {
					country_tier = kingdom
					country_tier = principality
				}
			}
			change_tag = SGF
		}
		else_if = {
			limit = {
				country_has_primary_culture = cu:rheinish
				NOT = { exists = c:CFR }
				OR = {
					country_tier = kingdom
					country_tier = principality
				}
			}
			change_tag = CFR
		}
	}
	option = {
		name = german_unification.1.b
		add_modifier = {
			name = partial_german_unification_influence_prestige
			months = normal_modifier_time
		}
		if = {
			limit = {
				country_has_primary_culture = cu:north_german
				NOT = { exists = c:NGF }
				OR = {
					country_tier = kingdom
					country_tier = principality
				}
			}
			change_tag = NGF
		}
		else_if = {
			limit = {
				country_has_primary_culture = cu:south_german
				NOT = { exists = c:SGF }
				OR = {
					country_tier = kingdom
					country_tier = principality
				}
			}
			change_tag = SGF
		}
		else_if = {
			limit = {
				country_has_primary_culture = cu:rheinish
				NOT = { exists = c:CFR }
				OR = {
					country_tier = kingdom
					country_tier = principality
				}
			}
			change_tag = CFR
		}
	}
}

# Annex a German country
german_unification.2 = {
	type = country_event
	placement = ROOT

	title = german_unification.2.t
	desc = german_unification.2.d
	flavor = german_unification.2.f

	event_image = {
		video = "gfx/event_pictures/unspecific_signed_contract.bk2"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"
	on_opened_soundeffect = "event:/SFX/Events/unspecific/signed_contract"

	icon = "gfx/interface/icons/event_icons/event_portrait.dds"

	duration = 3

	cooldown = { months = 4 }

	trigger = {
		root.infamy < infamy_threshold:infamous
		OR = {
			country_tier = empire
			country_tier = kingdom
			country_tier = principality
		}
		any_country = {
			trigger_if = {
				limit = {
					has_technology_researched = pan-nationalism
				}
				OR = {
					country_has_primary_culture = cu:north_german
					country_has_primary_culture = cu:south_german
					country_has_primary_culture = cu:rheinish
				}
			}
			trigger_else_if = {
				limit = {
					ROOT = {
						country_has_primary_culture = cu:north_german
					}
				}
				country_has_primary_culture = cu:north_german
			}
			trigger_else_if = {
				limit = {
					ROOT = {
						country_has_primary_culture = cu:south_german
					}
				}
				country_has_primary_culture = cu:south_german
			}
			trigger_else_if = {
				limit = {
					ROOT = {
						country_has_primary_culture = cu:rheinish
					}
				}
				country_has_primary_culture = cu:rheinish
			}
			OR = {
				is_subject_of = ROOT
				has_diplomatic_pact = {
					who = ROOT
					type = customs_union
				}
				AND = {
					country_has_primary_culture = cu:south_german
					has_diplomatic_pact = {
						who = c:BRG #SGF The Partition Solution - Burgundy
						type = customs_union
					}
				}
			}
			OR = {
				is_subject = no
				is_subject_of = ROOT
			}
			country_rank < rank_value:major_power
			relations:root >= relations_threshold:amicable
			is_player = no
			NOT = { has_variable = german_minor_dont_annex }
			NOR = { #Swiss confederation + Osnabruck
				AND = {
					exists = c:FIO
					this = c:FIO
				}
				AND = {
					exists = c:BAE
					this = c:BAE
				}
				AND = {
					exists = c:GRB
					this = c:GRB
				}
				AND = {
					exists = c:SWI
					this = c:SWI
				}
				AND = {
					exists = c:OSN
					this = c:OSN
				}
			}
		}
	}

	immediate = {
		random_country = {
			limit = {
				trigger_if = {
					limit = {
						has_technology_researched = pan-nationalism
					}
					OR = {
						country_has_primary_culture = cu:north_german
						country_has_primary_culture = cu:south_german
						country_has_primary_culture = cu:rheinish
					}
				}
				trigger_else_if = {
					limit = {
						ROOT = {
							country_has_primary_culture = cu:north_german
						}
					}
					country_has_primary_culture = cu:north_german
				}
				trigger_else_if = {
					limit = {
						ROOT = {
							country_has_primary_culture = cu:south_german
						}
					}
					country_has_primary_culture = cu:south_german
				}
				trigger_else_if = { #DVG
					limit = {
						ROOT = {
							country_has_primary_culture = cu:rheinish
						}
					}
					country_has_primary_culture = cu:rheinish
				}
				OR = {
					is_subject_of = ROOT
					has_diplomatic_pact = {
						who = ROOT
						type = customs_union
					}
					AND = {
						country_has_primary_culture = cu:south_german
						has_diplomatic_pact = {
							who = c:BRG #SGF The Partition Solution - Burgundy
							type = customs_union
						}
					}
				}
				OR = {
					is_subject = no
					is_subject_of = ROOT
				}
				country_rank < rank_value:major_power
				relations:root >= relations_threshold:amicable
				is_player = no
				NOT = { has_variable = german_minor_dont_annex }
				NOR = { #Swiss confederation + Osnabruck
					AND = {
						exists = c:FIO
						this = c:FIO
					}
					AND = {
						exists = c:BAE
						this = c:BAE
					}
					AND = {
						exists = c:GRB
						this = c:GRB
					}
					AND = {
						exists = c:SWI
						this = c:SWI
					}
					AND = {
						exists = c:OSN
						this = c:OSN
					}
				}
			}
			save_scope_as = german_annex_country
		}
	}

	option = {
		name = german_unification.2.a
		default_option = yes
		annex = scope:german_annex_country
		ai_chance = {
			base = 1
		}
	}
	option = {
		name = german_unification.2.b
		change_relations = {
			country = scope:german_annex_country
			value = 20
		}
		scope:german_annex_country = {
			set_variable = {
				name = german_minor_dont_annex
				days = 1825
			}
		}
		ai_chance = {
			base = 0
		}
	}
}

# Bismarck
german_unification.3 = {
	type = country_event
	placement = ROOT

	title = german_unification.3.t
	desc = german_unification.3.d
	flavor = german_unification.3.f

	gui_window = event_window_1char_tabloid

	left_icon = scope:bismarck_scope

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"
	on_opened_soundeffect = "event:/SFX/Events/misc/1Character_Banner"

	icon = "gfx/interface/icons/event_icons/event_portrait.dds"

	duration = 3

	trigger = {
		NOT = { has_global_variable = bismarck_variable }
		ig:ig_landowners = {
			is_powerful = yes
			is_in_government = yes
		}
		game_date < 1898.1.1
	}

	immediate = {
		set_global_variable = bismarck_variable
		create_character = {
			first_name = Otto
			last_name = von_Bismarck
			ig_leader = yes
			interest_group = ig_landowners
			female = no
			birth_date = 1815.4.1
			dna = dna_otto_von_bismarck
			ideology = ideology_royalist
			traits = {
				direct
				cautious
			}
		}
		ig:ig_landowners = {
			save_scope_as = junkers
			leader = {
				save_scope_as = bismarck_scope
			}
		}
	}

	option = {
		name = german_unification.3.a
		default_option = yes
		show_as_tooltip = {
			create_character = {
				first_name = Otto
				last_name = von_Bismarck
				#role = politician # Remove this line
				ig_leader = yes
				interest_group = ig_landowners
				female = no
				birth_date = 1815.4.1
				ideology = ideology_royalist
				traits = {
					direct
					cautious
				}
			}
		}
		scope:bismarck_scope = {
			add_modifier = {
				name = bismarck_popular
			}
		}
		add_modifier = {
			name = realpolitik
			months = normal_modifier_time
		}
	}
	option = {
		name = german_unification.3.b
		default_option = yes
		show_as_tooltip = {
			create_character = {
				first_name = Otto
				last_name = von_Bismarck
				#role = politician # Remove this line
				ig_leader = yes
				interest_group = ig_landowners
				female = no
				birth_date = 1815.4.1
				ideology = ideology_royalist
				traits = {
					direct
					cautious
				}
			}
		}
		scope:bismarck_scope = {
			add_modifier = {
				name = bismarck_unpopular
			}
		}
		add_modifier = {
			name = germany_aggressive_expansion
			months = normal_modifier_time
		}
	}
}

# German Unification
german_unification.4 = {
	type = country_event
	placement = ROOT

	title = german_unification.4.t
	desc = german_unification.4.d
	flavor = german_unification.4.f

	event_image = {
		video = "gfx/event_pictures/unspecific_military_parade.bk2"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"
	on_opened_soundeffect = "event:/SFX/Events/unspecific/military_parade"

	icon = "gfx/interface/icons/event_icons/event_portrait.dds"

	duration = 3

	trigger = {
	}

	option = {
		name = german_unification.4.a
		default_option = yes
		give_claims_on_germany = yes

		ruler = {
			add_modifier = {
				name = german_unifier_ruler
			}
		}
	}
	option = {
		name = german_unification.4.b
		give_claims_on_germany = yes

		add_loyalists = {
			value = 0.1
			culture = cu:north_german
		}
		add_loyalists = {
			value = 0.1
			culture = cu:south_german
		}
		add_loyalists = { #DVG
			value = 0.1
			culture = cu:rheinish
		}
	}
}

# German Unification Bohemia
german_unification.10 = {
	type = country_event
	placement = ROOT

	title = german_unification.10.t
	desc = german_unification.10.d
	flavor = german_unification.10.f

	event_image = {
		video = "gfx/event_pictures/unspecific_military_parade.bk2"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"
	on_opened_soundeffect = "event:/SFX/Events/unspecific/military_parade"

	icon = "gfx/interface/icons/event_icons/event_portrait.dds"

	duration = 3

	option = {
		name = german_unification.10.a
		default_option = yes

		add_primary_culture = cu:czech

		add_loyalists = {
			value = 0.1
			culture = cu:czech
		}
	}
}